<?php session_start();


//get the q parameter from URL
$u=$_GET["u"];
$p=$_GET["p"];

$username = "root";
$pass = "";
$con = mysql_connect("localhost",$username,$pass);
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }


@mysql_select_db("progin_171_13509008", $con);

$query = "select * from user where user_name ='".$u."' and password ='".$p."'";
$hasil=  mysql_query($query);

$xfetch = mysql_fetch_array($hasil);

if($xfetch == null)
{
    $response = "gagal";
}
else
{
    $response = "berhasil";
    
    $_SESSION['user_name']=$u;
    $_SESSION['login']=true;
    //echo "<script>window.location='login_succeed.php'</script>";

}
//$response = "Halo ".$u.", password anda adalah ".$p;
echo $response;
mysql_close();
?>